@import helper._
@import java.util.Optional
@import java.util.UUID

@import com.example.auction.transaction.api.TransactionInfoStatus
@(showInlineInstruction: Boolean, isSeller: Boolean, itemId: UUID, deliveryPriceForm: Form[DeliveryPriceForm], transactionStatus: TransactionInfoStatus, errorMessage: Optional[String])(implicit nav: Nav)

@main(message("deliveryPrice")) {

    <h2>@message("deliveryPrice")</h2>

    @if(showInlineInstruction == true) {
        <p>@message("instruction.deliveryPrice")</p>
    }

    @foundationForm(deliveryPriceForm, routes.TransactionController.setDeliveryPrice(itemId.toString, transactionStatus.name, isSeller)) {
        @if(errorMessage.isPresent) {
            <div class="alert callout">
                <i class="fi-alert"></i> @errorMessage.get()
            </div>
        }

        <div class="column row">
            @if(transactionStatus.equals(TransactionInfoStatus.NEGOTIATING_DELIVERY) && isSeller) {
                @inputText(deliveryPriceForm("deliveryPrice"), 'type -> "number")
            } else {
                @inputText(deliveryPriceForm("deliveryPrice"), 'type -> "number",'readonly -> 'readonly)
            }
        </div>

        @if(transactionStatus.equals(TransactionInfoStatus.NEGOTIATING_DELIVERY) && isSeller) {
            <input type="submit" class="button" value="@message("submitDeliveryDetails")"/>
        }
    }
}
